1. To get started, select MATLAB Help or Demos from the Help menu.
The element type "name" must be terminated by the matching end-tag "</name>".
Could not parse the file: c:matlab7toolboxccslinkccslinkinfo.xml
>> s=pi*5^2
s=
78.5398
>> v=s*10
v=
785.3982
>> qiuhe(9)
ans =
1.0000
>> qiuhe(9)
ans =
1.0000
>> qiuhe(9)
ans =
2.8290
>> qiuhe(-9)
ans =
-9
>> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 5 Column: 10
Missing variable or function.
>> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
This statement is incomplete.
2. >> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 5
This statement is incomplete.
>> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
This statement is incomplete.
>> zs(3)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 7 Column: 8
This statement is incomplete.
>> zs(3)
ans =
1
>> zs(19)
ans =
1
>> zs(1:19)
>> zs(1:19)
>> zs(3,19)
??? Error using ==> zs
Too many input arguments.
>> isprime(3)
ans =
1
>> help prime
prime.m not found.
Use the Help browser Search tab to search the documentation, or
type "help help" for help command options, such as help for methods.
>> prime(3:19)
??? Undefined command/function 'prime'.
>> mod(1:9,3)
3. ans =
1 2 0 1 2 0 1 2 0
>> zs(3:9)
ans =
1
>> zs(4:9)
ans =
1
>> zs(4:9)
ans =
1
>> help mod
MOD Modulus after division.
MOD(x,y) is x - n.*y where n = floor(x./y) if y ~= 0. If y is not an
integer and the quotient x./y is within roundoff error of an integer,
then n is that integer. By convention, MOD(x,0) is x. The input
x and y must be real arrays of the same size, or real scalars.
The statement "x and y are congruent mod m" means mod(x,m) == mod(y,m).
MOD(x,y) has the same sign as y while REM(x,y) has the same sign as x.
MOD(x,y) and REM(x,y) are equal if x and y have the same sign, but
differ by y if x and y have different signs.
See also rem.
Overloaded functions or methods (ones with the same name in other directories)
help sym/mod.m
Reference page in Help browser
doc mod
>> zs(8)
ans =
4. 0
>> zs(8)
ans =
0
>> zs(8)
ans =
0
>> zs(8)
ans =
0
>> zs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.
>> zs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.
>> zs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.
>> zs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.
>> showzs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.
Error in ==> showzs at 5
if zs(i)
>> showzs(8)
??? Error: File: C:¥Documents and Settings¥Administrator¥桌面¥test¥zs.m Line: 8 Column: 8
The expression to the left of the equals sign is not a valid target for an assignment.
5. Error in ==> showzs at 5
if zs(i)
>> zs(8)
ans =
0
>> zs(8)
ans =
0
>> showzs(8)
ans =
2 3 5 7
>> showzs(100)
ans =
Columns 1 through 14
2 3 5 7 11 13 17 19 23 29 31 37 41 43
Columns 15 through 25
47 53 59 61 67 71 73 79 83 89 97
>> y=[1;2;3]
y=
1
2
3
>> y=[y;9]
y=
1
2
3
9
8. >> A*C
ans =
1.0000 0
0.0000 1.0000
>> % C 为 A 的逆矩阵
>> D=[2 3;4 6]
D=
2 3
4 6
>> D^(-1)
Warning: Matrix is singular to working precision.
ans =
Inf Inf
Inf Inf
>> B^(-1)
ans =
-0.1111 0.6667
0.3333 -1.0000
>> A = [2 3 -1; 1 -12 8; 6 5 -11];
>> b = [6;12;1];
>> x = A^(-1)*b
x=
3.1690
0.5106
1.8697
>> A
A=
2 3 -1
1 -12 8
6 5 -11
9. >> A(2,5)=0
A=
2 3 -1 0 0
1 -12 8 0 0
6 5 -11 0 0
>> size(A)
ans =
3 5
>> X=1:6
X=
1 2 3 4 5 6
>> X(:)
ans =
1
2
3
4
5
6
>> help sort
SORT Sort in ascending or descending order.
For vectors, SORT(X) sorts the elements of X in ascending order.
For matrices, SORT(X) sorts each column of X in ascending order.
For N-D arrays, SORT(X) sorts the along the first non-singleton
dimension of X. When X is a cell array of strings, SORT(X) sorts
the strings in ASCII dictionary order.
Y = SORT(X,DIM,MODE)
has two optional parameters.
DIM selects a dimension along which to sort.
MODE selects the direction of the sort
'ascend' results in ascending order
'descend' results in descending order
The result is in Y which has the same shape and type as X.
[Y,I] = SORT(X,DIM,MODE) also returns an index matrix I.
If X is a vector, then Y = X(I).
10. If X is an m-by-n matrix and DIM=1, then
for j = 1:n, Y(:,j) = X(I(:,j),j); end
When X is complex, the elements are sorted by ABS(X). Complex
matches are further sorted by ANGLE(X).
When more than one element has the same value, the order of the
elements are preserved in the sorted result and the indexes of
equal elements will be ascending in any index matrix.
Example: If X = [3 7 5
0 4 2]
then sort(X,1) is [0 4 2 and sort(X,2) is [3 5 7
3 7 5] 0 2 4];
See also issorted, sortrows, min, max, mean, median.
Overloaded functions or methods (ones with the same name in other directories)
help cell/sort.m
help sym/sort.m
help xregdesign/sort.m
help sweepset/sort.m
Reference page in Help browser
doc sort
To get started, select MATLAB Help or Demos from the Help menu.
The element type "name" must be terminated by the matching end-tag "</name>".
Could not parse the file: c:matlab7toolboxccslinkccslinkinfo.xml
>> A=[2 5 1;3.5 9 8;-2 3 6]
A=
2.0000 5.0000 1.0000
3.5000 9.0000 8.0000
-2.0000 3.0000 6.0000
>> format short
>> A
A=
2.0000 5.0000 1.0000
3.5000 9.0000 8.0000
-2.0000 3.0000 6.0000
>> x=9;
11. >> y=pi/6;
>> A=[2,5,cos(y);sin(y),x^2,8;x/2 3 6]
A=
2.0000 5.0000 0.8660
0.5000 81.0000 8.0000
4.5000 3.0000 6.0000
>> A(3 3)=0
??? A(3 3)=0
|
Error: Missing MATLAB operator.
>> A(3,3)=0
A=
2.0000 5.0000 0.8660
0.5000 81.0000 8.0000
4.5000 3.0000 0
>> help sort
SORT Sort in ascending or descending order.
For vectors, SORT(X) sorts the elements of X in ascending order.
For matrices, SORT(X) sorts each column of X in ascending order.
For N-D arrays, SORT(X) sorts the along the first non-singleton
dimension of X. When X is a cell array of strings, SORT(X) sorts
the strings in ASCII dictionary order.
Y = SORT(X,DIM,MODE)
has two optional parameters.
DIM selects a dimension along which to sort.
MODE selects the direction of the sort
'ascend' results in ascending order
'descend' results in descending order
The result is in Y which has the same shape and type as X.
[Y,I] = SORT(X,DIM,MODE) also returns an index matrix I.
If X is a vector, then Y = X(I).
If X is an m-by-n matrix and DIM=1, then
for j = 1:n, Y(:,j) = X(I(:,j),j); end
When X is complex, the elements are sorted by ABS(X). Complex
matches are further sorted by ANGLE(X).
When more than one element has the same value, the order of the
elements are preserved in the sorted result and the indexes of
equal elements will be ascending in any index matrix.
12. Example: If X = [3 7 5
0 4 2]
then sort(X,1) is [0 4 2 and sort(X,2) is [3 5 7
3 7 5] 0 2 4];
See also issorted, sortrows, min, max, mean, median.
Overloaded functions or methods (ones with the same name in other directories)
help cell/sort.m
help sym/sort.m
help xregdesign/sort.m
help sweepset/sort.m
Reference page in Help browser
doc sort
>> A(2,5)=1
A=
2.0000 5.0000 0.8660 0 0
0.5000 81.0000 8.0000 0 1.0000
4.5000 3.0000 0 0 0
>> A(1)
ans =
2
>> A(0)
??? Subscript indices must either be real positive integers or logicals.
>> size(A)
ans =
3 5
>> length(A)
ans =
5
20. 12
>> sum(y)/length(y)
ans =
0.5220
>> help mean
MEAN Average or mean value.
For vectors, MEAN(X) is the mean value of the elements in X. For
matrices, MEAN(X) is a row vector containing the mean value of
each column. For N-D arrays, MEAN(X) is the mean value of the
elements along the first non-singleton dimension of X.
MEAN(X,DIM) takes the mean along the dimension DIM of X.
Example: If X = [0 1 2
3 4 5]
then mean(X,1) is [1.5 2.5 3.5] and mean(X,2) is [1
4]
Class support for input X:
float: double, single
See also median, std, min, max, cov.
Overloaded functions or methods (ones with the same name in other directories)
help fints/mean.m
help sweepset/mean.m
Reference page in Help browser
doc mean
>> mean(y)
ans =
0.5220
>> help max
MAX Largest component.
For vectors, MAX(X) is the largest element in X. For matrices,
MAX(X) is a row vector containing the maximum element from each
column. For N-D arrays, MAX(X) operates along the first
non-singleton dimension.
21. [Y,I] = MAX(X) returns the indices of the maximum values in vector I.
If the values along the first non-singleton dimension contain more
than one maximal element, the index of the first one is returned.
MAX(X,Y) returns an array the same size as X and Y with the
largest elements taken from X or Y. Either one can be a scalar.
[Y,I] = MAX(X,[],DIM) operates along the dimension DIM.
When complex, the magnitude MAX(ABS(X)) is used, and the angle
ANGLE(X) is ignored. NaN's are ignored when computing the maximum.
Example: If X = [2 8 4 then max(X,[],1) is [7 8 9],
7 3 9]
max(X,[],2) is [8 and max(X,5) is [5 8 5
9], 7 5 9].
See also min, median, mean, sort.
Overloaded functions or methods (ones with the same name in other directories)
help quantizer/max.m
help fints/max.m
help localpspline/max.m
help localpoly/max.m
Reference page in Help browser
doc max
>> [Y,y] = MAX(X)
??? Undefined function or variable 'X'.
>> man(Y,y)
??? Undefined function or variable 'Y'.
>> man(y)
??? Undefined command/function 'man'.
>> max(y)
ans =
0.9917
>> find(y==max(y))
22. ans =
6
>> x=rand(5,1)
x=
0.9501
0.2311
0.6068
0.4860
0.8913
>> sort(x)
ans =
0.2311
0.4860
0.6068
0.8913
0.9501
>> help sort
SORT Sort in ascending or descending order.
For vectors, SORT(X) sorts the elements of X in ascending order.
For matrices, SORT(X) sorts each column of X in ascending order.
For N-D arrays, SORT(X) sorts the along the first non-singleton
dimension of X. When X is a cell array of strings, SORT(X) sorts
the strings in ASCII dictionary order.
Y = SORT(X,DIM,MODE)
has two optional parameters.
DIM selects a dimension along which to sort.
MODE selects the direction of the sort
'ascend' results in ascending order
'descend' results in descending order
The result is in Y which has the same shape and type as X.
[Y,I] = SORT(X,DIM,MODE) also returns an index matrix I.
If X is a vector, then Y = X(I).
If X is an m-by-n matrix and DIM=1, then
for j = 1:n, Y(:,j) = X(I(:,j),j); end
When X is complex, the elements are sorted by ABS(X). Complex
matches are further sorted by ANGLE(X).
When more than one element has the same value, the order of the
23. elements are preserved in the sorted result and the indexes of
equal elements will be ascending in any index matrix.
Example: If X = [3 7 5
0 4 2]
then sort(X,1) is [0 4 2 and sort(X,2) is [3 5 7
3 7 5] 0 2 4];
See also issorted, sortrows, min, max, mean, median.
Overloaded functions or methods (ones with the same name in other directories)
help cell/sort.m
help sym/sort.m
help xregdesign/sort.m
help sweepset/sort.m
Reference page in Help browser
doc sort
>> sort(x,ascend)
??? Undefined function or variable 'ascend'.
>> sort(x,ascending)
??? Undefined function or variable 'ascending'.
>> sort(x,'ascending')
??? Error using ==> sort
sorting direction must be 'ascend' or 'descend'.
>> sort(x,descend)
??? Undefined function or variable 'descend'.
>> -sort(-x)
ans =
0.9501
0.8913
0.6068
0.4860
0.2311
>> -x
ans =